import io.*;
public class IDReaderWriteObj
{
  private int nextNumber, newID; 
  private boolean openedOkay;
  private char nextChar;
  
  public IDReaderWriteObj() // a kind of "hybrid" constructor algorithm
  {


  TextFile inputFile;
    inputFile = new TextFile("LogFile.csv", "r");
    openedOkay = inputFile.openFile();

    inputFile.rewind();
    nextNumber = 1;
   
    if(inputFile.endOfFile() == false){
      for(int i=1; i<3; i++){ 
       nextChar = inputFile.readChar();
      }
      inputFile.clearRestOfLine();
    } else {
      
    
    /* do{
          for(int i=1; i<3; i++){ 
       nextChar = inputFile.readChar();
   }
       nextNumber = inputFile.readInt();
       System.out.println(nextNumber);
       inputFile.clearRestOfLine();
 
   }  while (inputFile.endOfFile() == false); */
    
   inputFile.closeFile();
    newID = (nextNumber+1);
    System.out.println(newID);
    }
   }
   
   public int getCurrentID() //accessor
   {
      return nextNumber;
   }
   
   public int getNewID()
   {
     return newID;
   }
   
   public boolean checkRange()
   {
     boolean check;
     check = false;
     if ((newID >= 1000) && (newID <= 9999))
     {
       check = true;
     } else{
       check = false;
     }
     return check;
   }
}

    